package com.cloud.cloudvideo.entity;

import java.io.Serializable;
import java.util.List;

import com.cloud.cloudvideo.utils.Constants;

import lombok.Data;


@Data
public class ResultModel<T> implements Serializable{
	
	public Integer code;
	public String msg;
	public Integer count;
	public T data;
	
	public ResultModel(Integer count, T data) {
		super();
		this.count = count;
		this.data = data;
		this.code = Constants.RESULT_SUCCESS_CODE;
		this.msg = Constants.RESULT_SUCCESS_MSG;
	}

	
	public ResultModel(Integer code, String msg, Integer count, T data) {
		super();
		this.code = code;
		this.msg = msg;
		this.count = count;
		this.data = data;
	}
	
	
	public static <T>  ResultModel<T> successWithData(T data,Integer count){
		return new ResultModel<T>(Constants.RESULT_SUCCESS_CODE, Constants.RESULT_SUCCESS_MSG, count, data);
	}
	
	public static <T>  ResultModel<T> successWithNoData(){
		return new ResultModel<T>(Constants.RESULT_SUCCESS_CODE, Constants.RESULT_SUCCESS_MSG, 0 , null);
	}
	
	public static <T>  ResultModel<T> fail(){
		return new ResultModel<T>(Constants.RESULT_FAIL_CODE,Constants.RESULT_FAIL_MSG, 0 , null);
	}






	
	
}
